function M = rotationMatrix(Rot)
% rotMatrix
%   Rot - Rotation vector with components for pitch, yaw, and roll as 
%         Euler angles.
%
% RETURN
%   M   - 4 x 4 rotation matrix.
%
% DESCRIPTION
%   See Shirley & Marschner (2009). Fundamentals of computer graphics (3rd
%   edition). A.K. Peters, Ltd. Natick MA 01760, pages 126.

%   Florian Raudies, 05/21/2013, Boston Universtiy.

M = [1 0            0            0; ...
     0 +cos(Rot(1)) -sin(Rot(1)) 0; ...
     0 +sin(Rot(1)) +cos(Rot(1)) 0; ...
     0 0            0            1] * ...
    [+cos(Rot(2)) 0 +sin(Rot(2)) 0; ...
     0            1  0           0; ...
     -sin(Rot(2)) 0 +cos(Rot(2)) 0; ...
     0            0  0           1] * ...
    [+cos(Rot(3)) -sin(Rot(3)) 0 0; ...
     +sin(Rot(3)) +cos(Rot(3)) 0 0; ...
     0            0            1 0; ...
     0            0            0 1];

